<?php
/**
* 作用：关注相关
* 作者: Jasmine@soe-soe.com
* 日期: 2016/5/12 11:44
* 公司: 浙江宣逸网络科技有限公司<www.soe-soe.com>
*/
namespace Wap\Controller;
use Common\Model\FollowModel;
use Wap\BaseController;
class FollowController extends BaseController {

    //加关注操作
    public function follow(){
        $uid = session('uid')+0;
        $fid = I('get.id',0,'intval');
        if(!$uid){
            $this->ajaxReturn(array('status'=>99));
        }
        if(!$fid)
            $this->ajaxReturn(array('status'=>1));
        $result = FollowModel::followOP($uid,$fid);

        $this->ajaxReturn($result);
        if($result['status']==0){
            $this->ajaxReturn(array('status'=>0));
        }else
            $this->ajaxReturn(array('status'=>1));
    }

    //我的粉丝加载更多
    public function loadMore(){
        $page = I('get.page',2,'intval');
        $uid = session('uid');

        $data = FollowModel::getMyFriendship($uid,1,$page,7);
        $this->smarty->assign('list',$data['data']);
        $html = $this->smarty->fetch('User/followMore.html');
        $this->ajaxReturn(array('status'=>0,'dataHtml'=>$html,'isPage'=>$data['nextPage']));
    }
    //我的关注加载更多
    public function concernMore(){
        $page = I('get.page',2,'intval');
        $uid = session('uid');

        $data = FollowModel::getMyFriendship($uid,0,$page,7);
        $this->smarty->assign('list',$data['data']);
        $html = $this->smarty->fetch('User/concernMore.html');
        $this->ajaxReturn(array('status'=>0,'dataHtml'=>$html,'isPage'=>$data['nextPage']));
    }

}